<template>
    <div>
        <div id="slider" class="mui-slider">
				<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<div class="mui-scroll">
						<a :class="['mui-control-item',t.title == '全部'?'mui-active':'']" href="#item1mobile" data-wid="tab-top-subpage-1.html" v-for="t in typeList" :key="t.id">
							{{t.title}}
						</a>
					</div>
				</div>

		</div>

		<ul>
			<router-link v-for="item in list" :key="item.id" :to="'/photoList/photoInfo/'+item.id">
				<img lazy='loading' :src="imgbase+'/images/'+item.imgurl"/>
				<!-- <div class="info">
					<h1 class="info-title">{{item.title}}</h1>
					<div class="info-body">{{item.zhaiyao}}</div>
				</div> -->
			</router-link>
		</ul>

    </div>
    
</template>
<script>
import mui from "../../lib/mui/js/mui.min.js"

export default {
	data(){
		return {
			typeList:[],
			list:[],
			imgbase:'http://localhost:3000'
		}
	},
	methods:{
		getTypes(){
			this.$ajax({
				url:'/phtyps',
				method:"get"
			}).then(resp=>{
				this.typeList.push(...resp.data.message);
			});
		},
		//获取类别下的图片
		getImgs(typeid){
			this.$ajax({
				url:"/lanimgs/"+typeid,
				method:"get"
			}).then(resp=>{
				this.list = resp.data.message;

			});
		}

	},
	created(){
		let typeobj = {
			"id":0,"title":'全部'
		}
		this.getTypes();
		this.typeList.unshift(typeobj);
		this.getImgs(0);

	},
	mounted(){
		mui('.mui-scroll-wrapper').scroll({
			deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
		});
		
	}
}
</script>
<style scoped>
* { touch-action: pan-y; } 
img[lazy='loading'] {
 width:100%;
	height: 100%;
  margin: auto;
} 
ul{
	list-style: none;
	margin: 0;
	padding: 10px;
	padding-bottom:0px;
}
li{
	background-color: #ccc;
	text-align: center;
	margin-bottom:10px;
	box-shadow:  0 0 6px ;
	

}
.info{
	color:white;
	position: absolute;
	bottom: 0;
	background-color: rgba(0,0,0,0.4);

}
.info-title{
	font-size:14px;

}
.info-body{
	font-size:13px;
}

</style>
